<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>

</head>

<body>
  <button id="btn">发送请求</button>
</body>
<script>
  let btn = document.querySelector(`#btn`)

  //创建实列
  const instance = axios.create({
    //配置公共路径
    baseURL: '/',
    //配置超时事件
    timeout: 10000,
    //设置请求头
    headers: { qqt: "qqt" }
  });


  btn.onclick = async function () {
    const re = await instance.get("/user", {

    })
    
    //axios成功的值这个对象
    console.log(re);
    //  config:是axios请求的时候传入的配置对象
    console.log(re.config);
    //请求头
    console.log(re.config.headers);
    //响应头
    console.log(re.headers);
  }

</script>

</html>